import Vue from 'vue'
import Router from 'vue-router'
import store from '../store/index'
import Common from './common'
import Test from './test'

Vue.use(Router)

const router = new Router({
  routes: [
    // 路由配置在此引入
    ...Common,
    ...Test
  ]
})

router.beforeEach((to, from, next) => {
  // 显示加载动画
  store.commit('showLoading')

  next()
})

router.afterEach((to) => {
  // 隐藏加载动画
  store.commit('hideLoading')
});

export default router
